package sz.szsmk.citizencard.ui.newversion.activity

import android.os.Bundle
import android.util.Log
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
import sz.szsmk.citizencard.model.network.bean.response.BaseBean
import sz.szsmk.citizencard.retrofitrxjava.newversion.ApiCallback
import sz.szsmk.citizencard.retrofitrxjava.newversion.HttpDateSource
import sz.szsmk.citizencard.retrofitrxjava.newversion.SubscriberCallBack
import sz.szsmk.citizencard.ui.newversion.bean.AuthRequest
import sz.szsmk.citizencard.ui.newversion.bean.AuthRes

class CheckAuthActivity : AppCompatActivity(){


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

        val authRequest = AuthRequest()
        authRequest.mobile = intent.getStringExtra("phoneNum")
        authRequest.userid = intent.getStringExtra("userid")

        HttpDateSource.createApi()?.authForSZ(authRequest)!!
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(SubscriberCallBack(object : ApiCallback<AuthRes?> {
                override fun onSuccess(response: AuthRes?) {
                    response?.let {

                        Log.e("jump", response.access_token)

                    }
                }

                override fun onFailure(model: BaseBean?, e: Throwable?) {
                    model?.let {   }
                }
            }))


    }
}